package nil.ed.simulator.request.ui.jfx.controller;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.AnchorPane;
import lombok.Getter;
import lombok.Setter;
import nil.ed.simulator.request.ui.jfx.manager.ControllerManager;
import nil.ed.simulator.request.ui.jfx.manager.FxManager;
import nil.ed.simulator.request.ui.jfx.ui.Controller;

import java.net.URL;
import java.util.ResourceBundle;

public class MainController extends AnchorPane implements Controller, Initializable {
    @FXML
    private Button splitButton;
	@FXML
    private CheckBox batch;
	@Setter
    @Getter
	private ControllerManager controllerManager;
    private boolean isSplit= false;

	@Override
	public void initialize(URL url, ResourceBundle resourceBundle) {
		ControllerManager.addController(this);
	}

	public void splitHandler(ActionEvent e) {
		if (!isSplit) {
			FxManager.getStage().setWidth(990);
			isSplit=true;
		}else {
			FxManager.getStage().setWidth(1500);
			isSplit=false;
		}
	}



//	public void batchHandler(ActionEvent e) {
//		TableViewController tableController=ControllerManager.getTable();
//		TableView<UserRow> table=tableController.getTable();
//		@SuppressWarnings("rawtypes")
//		Iterator it=table.getItems().iterator();
//		batch.isSelected();
//		System.out.println();
//		while(it.hasNext()) {
//			UserRow user=(UserRow) it.next();
//			user.getChoice().setSelected(batchFlag);
//		}
//	}
}
